<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserMsgLogTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_msg_log', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('msg_type', 20)->default('RC:TxtMsg')->comment('聊天类型');
            $table->integer('from_userid')->default(0)->comment('发起方ID');
            $table->integer('to_userid')->default(0)->comment('接收方ID');
            $table->string('from_account', 32)->default('')->comment('发起方IM账号');
            $table->string('to_account', 32)->default('')->comment('接收方IM账号');
            $table->text('msg_detail')->comment('聊天内容');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('1-有效，0-无效');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_msg_log');
    }
}
